YZ80CLK ver 0.1
8/9/92 by Steven N. Hirsch
This is a hastily kludged-up clock driver for use with
ZSDOS/ZDDOS under the MYZ80 emulation program. I take no
resonsibility for any crashes, problems or incompatibilities, but
it works fine on my system.
To install, run SETUPZST. Answer "NO" when asked "Extract clock
from library?", then specify MYZ80CLK.REL at the prompt for
external REL file name. Don't forget to generate drivers for any
and all datestamping methods you use.
Let me know if any problems arise. I am particularly interested
in any information on the host interface under MYZ80. A message
from the author alluding to special system calls was never
followed up with any hard information.
;
; MYZ80CLK.MAC
;
; ZSDOS clock interface for use with MYZ80 emulator
;
; Version 0.1 - 8/9/92 by Steven Hirsch
;
; This is a quick hack to enable ZSDOS access to system time
; and date under MYZ80 emulation. Simeon Cran did a great job
; on MYZ80 but is not forthcoming with technical information.
; Consider this code a quick "hack" only! In particular,
; no validation checks are made to ensure that we are running
; in the MYZ80 environment. Be careful!
;
; Revisions:
;
;
;
VER EQU 1
;
GETTIM EQU 0fff9h ;fixed entry-point for MYZ80 time and
;date call
;
.Z80
;
COMMON /_CLKID_/
;
DW 0 ;static year if needed
CLKNAM: DB 'MYZ80CLK'
;name of clock driver
DS CLKNAM+24-$,' '
DB VER/10+'0', '.', VER MOD 10+'0'
DB 0
DEFB 'MYZ80 Clock Driver',0
;
;
COMMON /_PARM_/
;
DW 0 ;no parms
DW 0
;
;
CSEG
;
READ:
PUSH HL ; save pointer to caller's buffer
LD BC,buff3 ; grab pointer to our buffer
PUSH BC ; save it, too
CALL GETTIM ; read system date/time to buffer in
; CPM3/P2DOS format
;
POP HL ; our local buffer is source
POP DE ; system buffer is dest
CALL P2UTIM ; convert to ZS format in system buffer
; except for seconds
;
LD A,(DE) ; which we will save aside for the moment
LDI ; now move new seconds to dest
DEC DE ; roll pointer back to caller buff+5
EX DE,HL ; and point HL to it per ZS docs
LD E,A ; old seconds in E per docs
;
LD A,1 ; say we're ok
RET
;
buff3: defb 0,0,0,0,0 ; receives CP/M-3 time/date
;
;
; Apologies to Carson Wilson, et al, for my disassembly
; of DSLIB. The SETUPZST loader will not resolve library
; references, so I needed to hard-code this. A venerable
; utility called ZRELMAC.COM was used to "decompile" the
; .REL image back to source code...
;
P2UTIM:
PUSH DE
LD E,(HL)
INC HL
LD D,(HL)
INC HL
PUSH HL
LD A,D
OR E
LD BC,00H
JR Z,P2UTIM+065H
LD HL,08EADH
SBC HL,DE
JR C,P2UTIM+065H
LD BC,07BAH
EX DE,HL
LD DE,016DH
CALL @L0
JR NZ,P2UTIM+021H
INC DE
OR A
SBC HL,DE
JR C,P2UTIM+02BH
JR Z,P2UTIM+02BH
INC BC
JR P2UTIM+018H
ADD HL,DE
LD A,01H
LD D,00H
PUSH HL
LD HL,mtable
LD E,(HL)
CP 02H
CALL Z,@L0
JR NZ,P2UTIM+03DH
INC E
EX (SP),HL
OR A
SBC HL,DE
JR C,P2UTIM+04AH
JR Z,P2UTIM+04AH
EX (SP),HL
INC HL
INC A
JR P2UTIM+034H
ADD HL,DE
EX (SP),HL
POP HL
CALL BIN2BC
LD H,B
LD B,A
LD A,L
LD L,C
CALL BIN2BC
LD C,A
LD DE,064H
OR A
SBC HL,DE
JR NC,P2UTIM+05BH
ADD HL,DE
LD A,L
CALL BIN2BC
POP DE
POP HL
LD (HL),A
INC HL
LD (HL),B
INC HL
LD (HL),C
INC HL
EX DE,HL
LDI
LDI
XOR A
RET
@L0:
BIT 0,C
RET NZ
BIT 1,C
RET
mtable:
db 31
db 28
db 31
db 30
db 31
db 30
db 31
db 31
db 30
db 31
db 30
db 31
;
;
BIN2BC:
PUSH BC
LD B,0FFH
INC B
SUB 0AH
JR NC,BIN2BC+03H
ADD A,0AH
LD C,A
LD A,B
ADD A,A
ADD A,A
ADD A,A
ADD A,A
ADD A,C
POP BC
RET
;
;
;
COMMON /_POST_/
;
RET
;
;
COMMON /_PRE_/
;
PRETST: JR PRETST1
DW PRETST
PRETST1:
SCF ; indicate ok
RET
;
;
END
VV }
1-%(TW }A=MQ~(WW[@9}
1-%^Z,6n)R>'mdH|8x>@#X0}DC X,9}A=MQ~^